/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.klikmee.sms.core.base.dao;

import com.klikmee.sms.core.model.Config;

/**
 * 
 * @author makcro
 */
public class ConfigDAO extends AbstractDAO<Config> {

	public ConfigDAO() {
		super( Config.class );
	}

	public void createParameter( String key, String value ) {
		Config configEntity = new Config();
		configEntity.setParamName( key );
		configEntity.setParamValue( value );
		
		create( configEntity );
	}

	public void deleteParameter( String key ) {
		entityManager.createQuery( "DELETE FROM Config c WHERE c.paramName = :paramName" ).setParameter( "paramName", key ).executeUpdate();
	}

	
	public String getParameterValue( String key ) {
		Config find = find( key );
		
		if(find != null){
			return find.getParamValue();
		}
		
		return null;
		
	}

}
